import { CHANGE_BANNER_LIST, CHANGE_NEWSONG_LIST } from './actionType'
import { getHomeSwiper, getPrivateMusic } from '../api/index'

export const change_banner_data = (value) => {
    return {
        type: CHANGE_BANNER_LIST,
        value
    }
}
export const chaneg_newsong_data = (value) => {
    return {
        type: CHANGE_NEWSONG_LIST,
        value
    }
}


export const getRecommendPrivateMusic = (params) => {
    return (dispatch) => {
        getPrivateMusic(params).then((res) => {
            const action = chaneg_newsong_data(res.data)
            dispatch(action)
        })
    }
}

export const getBanner = (params) => {
    console.log(params);
    return (dispatch) => {
        getHomeSwiper(params).then((res) => {
            console.log(res);
            const action = change_banner_data(res.banners)
            dispatch(action)
        })
    }
}